//
//  WJYThreePctureTableViewCell.m
//  WWLNetease
//
//  Created by dllo on 15/12/25.
//  Copyright © 2015年 Echo.Jobs. All rights reserved.
//

#import "WJYThreePctureTableViewCell.h"

@interface WJYThreePctureTableViewCell()

@property (nonatomic, retain) UIImageView *leftImageV;/**< 左侧图片 */
@property (nonatomic, retain) UIImageView *middleImageV;/**< 中间图片 */
@property (nonatomic, retain) UIImageView *rightImageV;/**< 右侧图片 */
@property (nonatomic, retain) UILabel *titleL;/**< 标题 */
@property (nonatomic, retain) UILabel *replyL;/**< 跟贴 */
@property (nonatomic, retain) UILabel *tagL;/**< 标识 */

@end

@implementation WJYThreePctureTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createViews];
    }
    return self;
}

#pragma mark- 重写方法
- (void)createViews
{
    // 标题
    self.titleL = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleL];
    [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.contentView).offset(10);
        make.right.equalTo(self.contentView).offset(-10);
        make.height.equalTo(@(15 * SIZE));
        
    }];
    self.titleL.font = [UIFont systemFontOfSize:16 * SIZE];
    
    
    
    // 左侧图片
    self.leftImageV = [[UIImageView alloc]init];
    [self.contentView addSubview:self.leftImageV];
    [self.leftImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleL);
        make.top.equalTo(self.titleL.mas_bottom).offset(10);
        make.width.equalTo(@((375 * KPropotionWidth - 10 * 4) / 3.0));
        make.bottom.equalTo(self.contentView).offset(-10);
        
        
    }];
    
    
    
    
    // 中间图片
    self.middleImageV = [[UIImageView alloc] init];
    [self.contentView addSubview:self.middleImageV];
    self.middleImageV.backgroundColor = [UIColor redColor];
    [self.middleImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftImageV.mas_right).offset(10);
        make.top.width.bottom.equalTo(self.leftImageV);
    }];

    
    // 右侧图片
    self.rightImageV = [[UIImageView alloc] init];
    [self.contentView addSubview:self.rightImageV];
    self.rightImageV.backgroundColor = [UIColor redColor];
    [self.rightImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.middleImageV.mas_right).offset(10);
        make.top.width.bottom.equalTo(self.leftImageV);
    }];

    
    
}

#pragma mark- 自定义传值方法

- (void)setNewsM:(WJYNewsModel *)newsM{
    
    
    // 标题
    self.titleL.text = newsM.title;
    
    // 左侧图片
    NSURL *leftImageUrl = [NSURL URLWithString:newsM.imgsrc];
    [self.leftImageV sd_setImageWithURL:leftImageUrl placeholderImage:[UIImage imageNamed:@""]];
  
    
    
    // 中间图片
    NSURL *middelImageUrl = [NSURL URLWithString:[[newsM.imgextra objectAtIndex:0] objectForKey:@"imgsrc"]];
    [self.middleImageV sd_setImageWithURL:middelImageUrl placeholderImage:[UIImage imageNamed:@""]];
    
 
    
    // 右侧图片
    NSURL *rightImageUrl = [NSURL URLWithString:[[newsM.imgextra objectAtIndex:1] objectForKey:@"imgsrc"]];
    [self.rightImageV sd_setImageWithURL:rightImageUrl placeholderImage:[UIImage imageNamed:@""]];
    

    
}










- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
